package com.tarena.lbs.stock.web.mapper;

import com.tarena.lbs.pojo.stock.dos.CouponStockDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface StockMapper {

    @Update("update coupon_stock set num=num-1 where coupon_id=#{couponId} and num>0")
    int updateCouponNumById(Integer couponId);

    @Select("select * from coupon_stock where coupon_id = #{couponId}")
    CouponStockDO selectStockByCouponId(Integer couponId);
}
